package 预习;

public class 大于平均年龄的员工 {
    public static void main(String[] args) {
        int[] arr = {31, 42, 23, 64, 25, 36};

        int count = getCount(arr);

        System.out.println("大于员工平均年龄的有"+count+"个");

    }

    public static int getCount(int[] arr) {
        int sum = 0;

        for (int i = 0; i < arr.length; i++) {
            sum += arr[i];
        }

        int avg = sum / arr.length;

        int count = 0;

        for (int i = 0; i < arr.length; i++) {

            if (arr[i] > avg) {
                count++;
            }

        }
        System.out.println(sum);
        System.out.println(avg);
        return count;
    }
}
